/***********************************************************************************************************
* TNA - The Network Auditor
* Copyright © 2012  Jeff Scaparra -- SPAWAR Systems Center LANT
*
* This file is a part of TNA.
* Orginally taken from INAV - Interactive Network Active-traffic Visualization
* Copyright © 2007  Nathan Robinson, Jeff Scaparra
* Copyright © 2008 Jeff Scaparra
*
* Description:
***********************************************************************************************************/

#include <sstream>
#include <string>

//FOR LEXICAL TYPE CHANGING 
//Call with int a = ss_atoi<int>( std::string );
template<typename RT>
RT ss_atoi( const std::string& the_string, bool hex = false )
{
  std::istringstream temp_ss(the_string);
  RT num;
  if( hex )
    temp_ss >> std::hex >> num;
  else
    temp_ss >> num;
  return num;
}

template< typename  RT >
std::string ss_itoa( const RT& num, bool hex = false )
{
  std::stringstream ss;
  if( hex )
    ss << std::hex << num;
  else
    ss << num;
  return ss.str();
}

